#!/bin/bash
source "$( dirname "${BASH_SOURCE[0]}" )/fs_utils.sh"

function all_apps() {
    local d="$1"
    dir_exists_or_die "$d"
    local ts=($(ls ${d}))
    ds=()
    for t in "${ts[@]}"
    do 
        if [ -d "${d}/${t}" ]
        then
            ds[${#ds[@]}]="${d}/${t}"
        fi
    done
    echo "${ds[@]}"
}

function all_plugets() {
    local appD="$1/plugets"
    dir_exists_or_die "$appD"

    ps=()
    for f in ${appD}/*.pluget
    do
        t=$( basename "$f" )
        t=${t%*.pluget}
        ps[${#ps[@]}]="$t"
    done
    echo "${ps[@]}"
}
